<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" errorPage="/error.jsp" isELIgnored="false" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache" %>
<%@ taglib uri="http://atleap.blandware.com/taglib" prefix="atleap" %>
<html:xhtml />

<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="CONTENT_LOCALES_COLLECTION_KEY" scope="page" />
<atleap:constants className="com.blandware.atleap.webapp.util.core.LinkedObjectsInfoContainer" var="TYPE_PAGE" />
<atleap:constants className="com.blandware.atleap.webapp.util.core.LinkedObjectsInfoContainer" var="TYPE_RESOURCE" />

<atleap:isUserInRole roles="core-linkedObjects-view" var="canViewLinkedObjects" />

<atleap:content identifier="information" ignore="true" />
<table cellpadding="2" cellspacing="0" border="0" class="tableView">
    <tr>
        <atleap:message key="core.contentResource.form.unknownMimeType" var="unknown" />
        <th align="left" width="50%"><atleap:message key="core.contentResource.form.mimeType" /></th>
        <td><c:out value="${(requestScope.file.mimeType != null) ? requestScope.file.mimeType : unknown}" escapeXml="true" /></td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.contentResource.form.size" /></th>
        <td>
			<c:out value="${requestScope.file.size}" escapeXml="true" />
		</td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.contentResource.form.uri" /></th>
        <td><c:out value="${requestScope.file.uri}" escapeXml="true" /></td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.contentResource.form.altUrl" /></th>
        <td><c:out value="${requestScope.file.altUrl}" escapeXml="true" /></td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.contentResource.form.description" /></th>
        <td>
            <atleap:iterator items="${sessionScope[pageScope.CONTENT_LOCALES_COLLECTION_KEY]}" var="contentLocale">
                <div class="readOnlyField">
                    <atleap:fieldValue valueMap="${contentLocale.title}" var="languageTitle" />
                    <c:if test="${empty languageTitle}">
                        <c:set var="languageTitle" value="${contentLocale.identifier}" />
                    </c:if>
                    ${languageTitle}:&nbsp;<atleap:fieldValue valueMap="${requestScope.file.description}" language="${contentLocale.identifier}" complexSearch="false" />
                </div>
            </atleap:iterator>
        </td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.contentResource.form.lastUpdatedDatetime" /></th>
        <td><atleap:formatDate value="${requestScope.file.lastUpdatedDatetime}" type="datetime" /></td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.contentResource.form.roles" /></th>
        <td><c:out value="${requestScope.file.rolesAsString}" escapeXml="true" /></td>
    </tr>
    <tr>
        <td colspan="2" align="right">
            <a href="${ctxPath}/servlet/resource/?uri=${requestScope.file.uri}&download=true"><atleap:message key="core.contentResource.form.download" /></a>
        </td>
    </tr>
    <c:if test="${canViewLinkedObjects}">
        <tr>
            <td colspan="2" align="right">
                <atleap:rewriteUrl action="core/contentResource/file/view" var="thisRedirectUrl" >
                    <atleap:param name="id" value="${requestScope.file.id}" />
                </atleap:rewriteUrl>
                <atleap:link action="core/linkedObjects/view?id=${requestScope.file.id}&type=${TYPE_RESOURCE}&justView=true">
                    <atleap:param name="redirectUrl" value="${thisRedirectUrl}" />
                    <atleap:message key="core.commons.buttons.viewLinkedObjects" />
                </atleap:link>
            </td>
        </tr>
    </c:if>
</table>
<atleap:form action="core/contentResource/callUpdate" method="GET" validateOnSubmit="false">
            <html:hidden property="id" value="${requestScope.file.id}" />
            <atleap:isUserInRole roles="core-contentResource-update">
                <atleap:submit styleClass="button"><atleap:message key="core.commons.buttons.callUpdate" /></atleap:submit>
            </atleap:isUserInRole>
            <atleap:cancel styleClass="button"><atleap:message key="core.commons.buttons.showList" /></atleap:cancel>
</atleap:form>

